package com.main.accountpermissionsmanagement.interfaces.assembler;

import com.main.accountpermissionsmanagement.domain.account.entity.Account;
import com.main.accountpermissionsmanagement.interfaces.dto.AccountDTO;
import com.main.accountpermissionsmanagement.interfaces.dto.AddAccountDTO;
import com.main.common.base.base.BaseAssembler;
import com.main.common.base.base.BaseAssemblerFactory;
import jakarta.validation.constraints.NotNull;

import java.util.ArrayList;
import java.util.List;

public class AccountAssembler {
    private final BaseAssembler<Account, AddAccountDTO> baseAssembler;

    public AccountAssembler(@NotNull BaseAssemblerFactory baseAssemblerFactory) {
        this.baseAssembler = baseAssemblerFactory.getService(AddAccountDTO.class);
    }

    public Account toEntity(AddAccountDTO accountDTO) {
        Account account = new Account();
        account = baseAssembler.toEntity(accountDTO, account);
        account.setUserId(accountDTO.getUserId());
        account.setNumber(accountDTO.getNumber());
        account.setPassword(accountDTO.getPassword());
        return account;
    }

}